package com.wf.ew.orderB.service.impl;

import com.wf.ew.common.JsonResult;
import com.wf.ew.common.PageResult;
import com.wf.ew.system.model.User;
import com.wf.ew.orderB.biz.ScoreBiz;
import com.wf.ew.orderB.model.Score;
import com.wf.ew.orderB.service.ScoreService;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;

/**
 *
 * 数据服务层接口实现类
 * @author : Doman
 * @date : 2020-04-15 13:27:18
 * @version ：1.0
 */
@Service
public class ScoreServiceImpl implements ScoreService {

	@Autowired
	private ScoreBiz scoreBiz;

	@Override
	public String list(PageResult<T> page, Score score, User loginUser) {
		return scoreBiz.list(page,score,loginUser);
	}
	
	@Override
	public List<Score> list(Score score, User loginUser) {
		return scoreBiz.list(score,loginUser);
	}

	@Override
	public Score getById(Score score) {
		return scoreBiz.getById(score);
	}

	@Transactional
	@Override
	public JsonResult add(Score score, User loginUser) {
		if (scoreBiz.add(score, loginUser)) {
			return JsonResult.ok("添加成功");
		}
		return JsonResult.error("添加失败");
	}

	@Transactional
	@Override
	public JsonResult update(Score score, User loginUser) {
		if (scoreBiz.update(score, loginUser)) {
			return JsonResult.ok("修改成功");
		}
		return JsonResult.error("修改失败");
	}

	@Transactional
	@Override
	public JsonResult delete(Score score, User loginUser) {
		if (scoreBiz.delete(score, loginUser)) {
			return JsonResult.ok("删除成功");
		}
		return JsonResult.error("删除失败");
	}
}
